package com.flynn.rock.system.entity;

import com.flynn.rock.enums.system.UserStatus;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@Table(name = "sys_user")
@EntityListeners(AuditingEntityListener.class)
public class SysUserEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id", nullable = false)
    private Long userId;

    @Column(name = "user_code", length = 64)
    private String userCode;

    @Column(name = "real_name", length = 64)
    private String realName;

    @Column(name = "nick_name", length = 64)
    private String nickName;

    @Column(name = "gender", length = 6)
    private String gender;

    @Column(name = "age")
    private Integer age;

    @Column(name = "phone", length = 32)
    private String phone;

    @Column(name = "email", length = 64)
    private String email;

    @Lob
    @Column(name = "avatar")
    private String avatar;

    @Column(name = "create_user_id")
    private Long createUserId;

    @Column(name = "dept_id")
    private Long deptId;

    @CreatedDate
    @Column(name = "create_time")
    private LocalDateTime createTime;

    @LastModifiedDate
    @Column(name = "update_time")
    private LocalDateTime updateTime;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", length = 32)
    private UserStatus status;

    @Column(name = "remark", length = 64)
    private String remark;
}